<template>
  <div>
    <page-nav :titlearr="titlearr"></page-nav>
    <div class="video_form">
      <el-input v-model="searchText"></el-input>
      <el-button type="success"
                 @click="search">查询</el-button>
      <el-button type="primary"
                 @click="changeVideoFlag(true)">添加视频</el-button>
    </div>
    <video-table :state="state"
                 :dirid="dirid"
                 :CDid="CDid"></video-table>
    <video-alert></video-alert>

  </div>
</template>
<script>
import pageNav from '../../components/pageNav'
import videoAlert from './videoAlert'
import videoTable from './videoTable'
import { mapMutations, mapActions } from 'vuex';

export default {
  props: ["state", "dirid", "CDid"],
  name: "videos",
  components: {
    pageNav,
    videoAlert,
    videoTable
  },
  methods: {
    ...mapActions("videoStore", ["getVideoAction"]),
    ...mapMutations("videoStore", ["changeVideoFlag"]),
    search () {//查询
      this.getVideoAction({ searchText: this.searchText })
    }
  },
  data () {
    return {
      searchText: "",
      titlearr: [
        { name: "home", text: "首页" },
        { name: "video", text: "课程管理" },
        { name: "video", text: "视频管理" },
      ]
    }
  }
}
</script>
<style lang="less">
.video_form {
  width: 80%;
  margin: 20px auto;
  background: white;
  display: flex;
  .el-input {
    width: 300px;
  }
}
</style>